package com.dc.ai.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dc.ai.entity.po.Product;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ProductMapper extends BaseMapper<Product> {

    @Select("select * from products p left join user_product up on p.product_id = up.product_id where up.user_id = #{userId}")
    List<Product> productListbyUserId(String userId);

    @Select("select * from products where product_id = #{productId}")
    Product getProductById(Long productId);
}
